package cate.common.table.activity.wishblessing.sheet;

import cate.common.table.ESheet;
import cate.common.table.activity.wishblessing.row.WishBlessingEventRow;
import cate.common.util.random.RWList;

import java.util.stream.Collectors;

public class WishBlessingEventSheet extends ESheet<WishBlessingEventRow> {
    @Override
    public String getSheetName() {
        return "幸运事件";
    }

    public String getLuckyItemStr(int configId) {
        WishBlessingEventRow row = getList().stream().filter(e -> e.configId == configId).findAny().orElse(null);
        return row == null ? null : row.luckyCostStr;
    }

    public WishBlessingEventRow randomEvent(int configId) {
        RWList<WishBlessingEventRow> list = new RWList<>();
        list.addAll(getList().stream().filter(e -> e.configId == configId).collect(Collectors.toList()));
        return list.setup().get();
    }
}
